package com.admin.common.util;

import com.admin.common.enums.CodeEnum;

/**
 * @program: xj-shop
 * @description:
 * @author: 徐健
 * @create: 2022-09-01 11:08
 **/
public class CommRest {
    public static Rest error(CodeEnum code, String msg, Object data){
        return new Rest(code,msg,data);
    }
    public static Rest error(CodeEnum code, Object data){
        return error(code,code.getValue(),data);
    }
    public static Rest error(CodeEnum code){
        return error(code,null);
    }
    public static Rest error(){
        return error(CodeEnum.ERROR_SUCCESS,null);
    }

    public static Rest success(CodeEnum code, String msg, Object data){
        return new Rest(code,msg,data);
    }
    public static Rest success(CodeEnum code, Object data){
        return success(code,code.getValue(),data);
    }
    public static Rest success(CodeEnum code){
        return success(code,null);
    }
    public static Rest success(Object data){
        return success(CodeEnum.CODE_SUCCESS,data);
    }
    public static Rest success(){
        return success(CodeEnum.CODE_SUCCESS,null);
    }
}
